package com.beiding.pojo;

import org.springframework.data.annotation.Transient;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;

public class MultipartFileResource extends StaticResource {


    @Transient
    private MultipartFile multipartFile;

    public MultipartFileResource() {
    }

    public MultipartFileResource(MultipartFile multipartFile) {
        this.multipartFile = multipartFile;
        setFileName(multipartFile.getOriginalFilename());
    }

    @Override
    protected void doPersistent(File loc) throws IOException {

            multipartFile.transferTo(loc);
    }


}
